package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


public class GenericDao {
	private static Connection con;
	
	public static Connection getConnection(){
		
		try{
			String driver = "net.sourceforge.jtds.jdbc.Driver";
			String endereco = "jdbc:jtds:sqlserver://localhost:1433;";
			String database = "DatabaseName=hotel_scrum;";
			String pipeNomeado = "namedPipe=false";
			String user = "sa";
			String senha = "1234";
			StringBuffer sb = new StringBuffer();
			sb.append(endereco);
			sb.append(database);
			sb.append(pipeNomeado);
			Class.forName(driver);
			con = DriverManager.getConnection(sb.toString(),user,senha);
		}
		catch (ClassNotFoundException e){
			e.printStackTrace();
		}
		catch (SQLException e){
			e.printStackTrace();
		}
		catch (Exception e){
			e.printStackTrace();
		}
		return con;
	}

}
